<?php
namespace app\common\validate;

use think\Validate;

class Banner extends Validate
{
    protected $rule = [
        'mid' => 'require|integer|>=:1',
        'name' => 'require',
        'url' => 'url',
        'sorts' => 'require|integer|>=:1',
        'status' => 'require|in:0,1',
    ];

    protected $message = [
        'mid' => 'mid_require',
        'name' => 'name_require',
        'url' => 'url_require',
        'sorts' => 'sorts_require',
        'status' => 'status_require',
    ];

    protected $scene = [
        'create' => ['mid', 'name', 'url', 'sorts', 'status'],
        'edit'   => ['mid', 'name', 'url', 'sorts', 'status'],
        'name'   => ['name'],
        'url'    => ['url'],
        'sorts'  => ['sorts'],
        'status' => ['status'],
    ];
}